package com.t235.gc.biz.service.impl;

import com.t235.gc.entity.PartnersCashRecord;
import com.t235.gc.dao.PartnersCashRecordDao;
import com.t235.gc.biz.service.PartnersCashRecordService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 合伙人提现记录表(PartnersCashRecord)表服务实现类
 *
 * @author makejava
 * @since 2021-03-24 08:45:35
 */
@Service("partnersCashRecordService")
public class PartnersCashRecordServiceImpl implements PartnersCashRecordService {
    @Resource
    private PartnersCashRecordDao partnersCashRecordDao;

    /**
     * 通过ID查询单条数据
     *
     * @param cashid 主键
     * @return 实例对象
     */
    @Override
    public PartnersCashRecord queryById(Long cashid) {
        return this.partnersCashRecordDao.queryById(cashid);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit  查询条数
     * @return 对象列表
     */
    @Override
    public List<PartnersCashRecord> queryAllByLimit(int offset, int limit) {
        return this.partnersCashRecordDao.queryAllByLimit(offset, limit);
    }

    /**
     * 新增数据
     *
     * @param partnersCashRecord 实例对象
     * @return 实例对象
     */
    @Override
    public PartnersCashRecord insert(PartnersCashRecord partnersCashRecord) {
        this.partnersCashRecordDao.insert(partnersCashRecord);
        return partnersCashRecord;
    }

    /**
     * 修改数据
     *
     * @param partnersCashRecord 实例对象
     * @return 实例对象
     */
    @Override
    public PartnersCashRecord update(PartnersCashRecord partnersCashRecord) {
        this.partnersCashRecordDao.update(partnersCashRecord);
        return this.queryById(partnersCashRecord.getCashid());
    }

    /**
     * 通过主键删除数据
     *
     * @param cashid 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Long cashid) {
        return this.partnersCashRecordDao.deleteById(cashid) > 0;
    }
}
